package com.itheima.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collectors;

public class Demo03 {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("张三丰", "张翠山", "张无忌", "王二麻子", "张良", "谢广坤", "赵四"));
        //缺 Collector  Collectors.toList()
        List<String> result = list.stream().filter(s -> s.startsWith("张")).collect(Collectors.toList());
        System.out.println(result);
        //缺 Collector  Collectors.toSet()
        Set<String> set = list.stream().filter(s -> s.length() == 3).collect(Collectors.toSet());
        System.out.println(set);
    }
}
